home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / LOADGIF.ZIP / TEST.BAS < prev   
BASIC Source File  |  1993-08-20  |  3KB  |  99 lines

  1. 'Simple test program for LoadGIF.
  2. 'Change all "VARSEG"'s to "SSEG"'s for PDS or VB-DOS.
  3.  
  4. 'Input a GIF file's filename on the command line and it will be shown
  5. 'on the 320x200x256 color mode.
  6.  
  7. DEFINT A-Z
  8. '$INCLUDE: 'LOADGIF.BI'
  9. ''$INCLUDE: 'MODEX.BI' 'For MODEX library example.
  10.  
  11. A$ = COMMAND$
  12. IF LEN(A$) = 0 THEN END
  13.  
  14. IF INSTR(A$, ".") = 0 THEN A$ = A$ + ".GIF"
  15. A$ = A$ + CHR$(0)  'Make ASCIZ filename
  16.  
  17. SCREEN 13 '320x200x256, 6 bits per primary.
  18. ScrType = 1             'Select mode 13 pixel plotter.
  19. ScrOffset = 0           'Screen offset is 0.
  20. ScrWidth = 320          '320 bytes per scanline.
  21. XRes = 319              'Screen size is (0,0)-(319,199)
  22. YRes = 199
  23. AdapterType = 1         'Set VGA palette.
  24.  
  25. 'SCREEN 12 '640x480x16, 6 bits per primary.
  26. 'ScrType = 0             'Select 16 color mode pixel plotter.
  27. 'ScrOffset = 0           'Screen offset is 0.
  28. 'ScrWidth = 80           '80 bytes per scanline.
  29. 'XRes = 639              'Screen size is (0,0)-(639,479)
  30. 'YRes = 479
  31. 'AdapterType = 1         'Set VGA palette.
  32.  
  33. 'SCREEN 9 '640x350x16, 2 bits per primary.
  34. 'ScrType = 0             'Select 16 color mode pixel plotter.
  35. 'ScrOffset = 0           'Screen offset is 0.
  36. 'ScrWidth = 80           '80 bytes per scanline.
  37. 'XRes = 639              'Screen size is (0,0)-(639,479)
  38. 'YRes = 349
  39. 'AdapterType = 0         'Set EGA palette.
  40.  
  41. 'Example for Matt Pritchard's MODEX library. (Make sure you
  42. 'unremark the INCLUDE statement above.)
  43. 'Null = SET.MODEX(Mode360x480)
  44. 'ScrType = 2             'Select mode-x pixel plotter.
  45. 'ScrOffset = 0           'Screen offset is 0.
  46. 'ScrWidth = 90           '90 bytes per scanline.
  47. 'XRes = 359              'Screen size is (0,0)-(359,479)
  48. 'YRes = 479
  49. 'AdapterType = 1         'Set VGA palette.
  50.  
  51. X0 = 0                  'View window covers entire screen.
  52. Y0 = 0                  'Any points outside of this window will not
  53. X1 = XRes               'be plotted.
  54. Y1 = YRes
  55.  
  56. XOrg = 0                'Upper left hand corner of GIF goes at (0,0).
  57. YOrg = 0
  58.  
  59. PalIgnore = 0           'Don't ignore palette.
  60.  
  61. 'Allocate the memory required by the LoadGIF function.
  62. REDIM GIFMem(LoadGIFMem * 8) AS INTEGER '8 integers = 16 bytes = 1 page.
  63. MemPointer = VARSEG(GIFMem(0))
  64.  
  65. A = LoadGIF(MemPointer, VARSEG(A$), SADD(A$), ScrType, ScrOffset, ScrWidth, XRes, YRes, X0, Y0, X1, Y1, XOrg, YOrg, AdapterType, PalIgnore, 0, 0, PalColors)
  66.  
  67. 'Deallocate memory required by the LoadGIF function.
  68. REDIM GIFMem(0) AS INTEGER
  69.  
  70. IF A THEN 'check error variable
  71.         SCREEN 0: WIDTH 80
  72.         SELECT CASE ErrorReport
  73.         CASE 0 TO 99
  74.                 PRINT "Critical Error #:"; ErrorReport
  75.         CASE IS >= 100
  76.                 PRINT "DOS Error #:"; ErrorReport
  77.         CASE -1
  78.                 PRINT "End of file before GIF terminator."
  79.         CASE -2
  80.                 PRINT "LZW data stream is corrupted."
  81.         CASE -3
  82.                 PRINT "Not a GIF file."
  83.         CASE -4
  84.                 PRINT "Too many colors in GIF file for screen mode."
  85.         CASE -5
  86.                 PRINT "Bad image descriptor or GIF too big to be processed."
  87.         CASE -6
  88.                 PRINT "ScrType parameter is bad. Must be 0, 1 or 2."
  89.         CASE -7
  90.                 PRINT "AdapterType parameter is bad or EGA palette specified for"
  91.                 PRINT "a 256 color mode."
  92.         END SELECT
  93.         END
  94. END IF
  95.  
  96. A$ = INPUT$(1)
  97. SCREEN 0: WIDTH 80
  98.  
  99.